package org.yaukie.auth.constant;

public class AuthCons {
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
    public static final String LOGIN_TOKEN_KEY = "login_token_";
    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
    public static final Integer CAPTCHA_EXPIRATION = 2;
    public static final String TOKEN = "token";
    public static final String TOKEN_PREFIX = "Bearer ";
    public static final String LOGIN_USER_KEY = "login_user_key";
    public static final String JWT_USERID = "userid";
    public static final String JWT_USERNAME = "sub";
    public static final String JWT_AVATAR = "avatar";
    public static final String JWT_CREATED = "created";
    public static final String JWT_SECRET = "yuenbinisagreatman!";

    public AuthCons() {
    }

    public static enum UserStatus {
        OK("0", "正常"),
        DISABLE("1", "停用"),
        DELETED("2", "删除");

        private final String code;
        private final String info;

        private UserStatus(String code, String info) {
            this.code = code;
            this.info = info;
        }

        public String getCode() {
            return this.code;
        }

        public String getInfo() {
            return this.info;
        }
    }

    public static enum Token {
        TOKEN_OK(20000, "令牌校验成功"),
        TOKEN_NOT_VALID(20001, "令牌校验失败"),
        TOKEN_EXPIRED(20002, "令牌过期");

        int code;
        String des;

        private Token(int code, String des) {
            this.code = code;
            this.des = des;
        }

        public int getCode() {
            return this.code;
        }

        public String getDes() {
            return this.des;
        }
    }

    public static enum Login {
        LOGIN_SUCCESS(30000, "登录成功"),
        LOGIN_OUT(40000, "注销成功"),
        LOGIN_OUT_FAIL(40001, "注销失败"),
        LOGIN_FAIL(30001, "登录失败");

        int code;
        String des;

        private Login(int code, String des) {
            this.code = code;
            this.des = des;
        }

        public int getCode() {
            return this.code;
        }

        public String getDes() {
            return this.des;
        }
    }
}